1. Technical Field
The present invention relates to a system and method for Java™ call stack sampling combined with native sampling. More particularly, the present invention relates to a system and method for generating a unified output tree that includes returned call stack nodes and native function leaf nodes.
2. Description of the Related Art
Existing art provides limited capability to generate a complete call stack. A call stack includes information corresponding to active subroutines in a concise and organized manner. One approach to profiling execution is through a sampling profiler, such as a “tprof” executable, which is delivered with AIX™ (Advanced Interactive executive). The primary advantage of tprof is that there is minimal overhead required. A challenge found with tprof, however, is that although tprof provides native process information, it does not provide hierarchy. Another approach to profile execution is to attempt to retrieve a native call stack when taking a sample. However, this approach is typically not portable and does not include Java™ context.
Yet another approach to generate a call stack is through a Java™ profiler agent, which accepts entry/exit events generated by instrumentation built into a Java™ Virtual Machine (JVM), or JVM methods that are instrumented using byte code instrumentation. Both JVMPI (Java™ Virtual Machine Profiling Interface) and JVMTI (Java™ Virtual Machine Tool Interface) support entry/exit events. One disadvantage with this approach is that the profiler agent requires an extreme amount of overhead because it processes every entry/exit point. Another disadvantage with this approach is that it only provides information at the Java™ method level.
Kernel/device driver sampling based profilers may traverse a native stack, which provides a hierarchy, but does not include Java™ interpreted methods. Alternatively, application-based profilers may gain control at an operating system level granularity by setting an application level timer. However, these profilers may give biased results due to operating system scheduling algorithms. Both JVMPI and JVMTI provide an interface to retrieve call stacks that are internal to the JVM. Profilers may use these interfaces to retrieve Java™ call stacks, but the Java™ call stacks do not include the full context of native code that may be executing at the time of an interrupt. As a result, an application-based profiler may not identify a thread that was executing during the interrupt.
What is needed, therefore, is a system and method that effectively and efficiently generates complete call stack information.